(function($){
	$(document).ready(function(){
		$("#id_app").css('display', 'none');
		$("#lookup_id_app").after("&nbsp;&nbsp;&nbsp;<a target='_blank' href='##' id='id_app_name'></a>");
		$("#id_app_name").parent().append("<span class='help-block'><strong><i>Click the 'magnifying glass' icon to choose an app</i></strong></span>");
		
		$("#id_cross_local").bind('input', function(){
			if($(this).val() != ""){
				var local = $(this).val().replace(/\\/g, '/');
				if(local.indexOf(":") > -1){
					var prefix = local.split(":", 1);
					$("#id_cross_remote").val(local.replace(prefix + ":", 'https://www.dropbox.com/home/Small Tree Media/Project Submission Doc'));
				}else{
					var prefix = local.split("/Project Submission Doc/", 1);
					$("#id_cross_remote").val(local.replace(prefix, 'https://www.dropbox.com/home/Small Tree Media'));
				}
			}else{
				$("#id_cross_remote").val("");
			}
		});
	});
})(django.jQuery);
